package designpattern.struct.proxy.dynamic.jdks;

import java.lang.reflect.Proxy;

/**
 * JDK代理工厂类
 *
 * @author: cuihao
 * @create: 2020-09-22 14:17
 **/
public class JDKProxyFactory {
    public static Object getProxy(Object target) {
        return Proxy.newProxyInstance(
                target.getClass().getClassLoader(), // 设置加载类
                target.getClass().getInterfaces(), // 设置接口
                new DynamicHandler(target)); // 设置处理器
    }
}
